package sg.edu.nus.iss.pacman.dao;

import javax.microedition.rms.RecordFilter;

import sg.edu.nus.iss.pacman.util.IOUtils;

/**
 * User Profile filter based on user name
 *  
 * @author Daniel
 *
 */
public class UserProfileFilter implements RecordFilter {

	private String userName;
	
	public UserProfileFilter(String userName) {
		this.userName = userName;
	}
	
	public boolean matches(byte[] byteUser) {

		UserProfile user = IOUtils.convertBytesToUserProfile(byteUser);
		
		if (userName.equals(user.getName())) {
			return true;
		}
		
		return false;
	}

}
